package com.example.demo.service;

import com.example.demo.mapper.UserInfoMapper;
import com.example.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by xiebang
 * Description
 * User:小谢
 * Date:2022-09-20
 * Time:17:11
 */
@Service
public class UserService {
    @Autowired
    private UserInfoMapper userInfoMapper;

//    用户注册
    public int addUser(User user){
        return userInfoMapper.addUser(user);
    }

//    修改密码
    public int updateByUsername(String username,String newPassword){
        return userInfoMapper.updateByUsername(username,newPassword);
    }
//    注销账户
    public int deleteUser(String username,String password){
            return userInfoMapper.deleteUser(username,password);
    }

//    查找用户根据账号
    public User selectByName(String username){
        return userInfoMapper.selectByName(username);
    }

//    查找用户根据id
    public User selectById(Integer id){
        return userInfoMapper.selectById(id);
    }

}
